package dao;

import java.util.LinkedList;
import java.util.List;

import entity.Role;
import entity.User;

public class UserDao {
	private static final User[] users={new User(1,"committer","",Role.RiskCommitter),
			new User(2,"tracer","",Role.RiskTracer),
	};
	
	public static List<User> getAllTracer(){
		List<User> result=new LinkedList<>();
		for(User u:users){
			if(u.getRole()==Role.RiskTracer){
				result.add(u);
			}
		}
		return result;
	}
	
	public static User[] getAllUser(){
		return users;
	}
	
	public static String getUsername(int userId){
		for(User u:users){
			if(u.getId()==userId){
				return u.getUsername();
			}
		}
		return null;
	}
	
}
